<?php
	include "inc/userAuth.php";
	include "inc/functions.php";
	$dd1 = "";
	$mm1 = "";
	$yyyy1 = "";
	$dd2 = "";
	$mm2 = "";
	$yyyy2 = "";
	$dd3 = "";
	$mm3 = "";
	$yyyy3 = "";

		include "conn/database.php";
		$sql = "SELECT * FROM `T_WEDDINGS` WHERE WEDDING_ID = '".$_SESSION['wid']."' limit 1";
		$res = mysql_query($sql);
		$rows = mysql_num_rows($res);
		if($rows>0){
			$result = mysql_fetch_array($res);
			
			$date1 = explode("-",$result['FIRST_MEETING']);
			$dd1 = $date1[2];
			$mm1 = $date1[1];
			$yyyy1 = $date1[0];
			
			$date2 = explode("-",$result['PROPOSE_DATE']);
			$dd2 = $date2[2];
			$mm2 = $date2[1];
			$yyyy2 = $date2[0];
			
			$date3 = explode("-",$result['WEDDING_DATE']);
			$dd3 = $date3[2];
			$mm3 = $date3[1];
			$yyyy3 = $date3[0];
		} else echo "error! No wedding id selected.";
?>
<!DOCTYPE html>
<html>
<head>
<meta name="Description" content="Une application mobile unique pour un mariage unique.">
<meta name="Keywords" content="wedding box, mariage, application mobile, appstore, google play, iphone, android, iphone 5, samsung galaxy s3, promesse d'une vie">
<title>Promesse d'une Vie</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link type="text/css" rel="stylesheet" media="screen" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.7.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/wedding_form.js" charset="utf-8"></script>
</head>

<body>

<div class="main-content" >
		<?php
			include "left-menu.php";
		?>
		
		<div class="right">
			<div id="left-shadow"></div>
			<div class="welcome relative">
				<a id="click-drop"><span>Bonjour <?php echo $_SESSION['fname']?></span></a>
				<a type="button" class="deconnect" value="" name="deconnect" id="bien-deconnect" style="display:none;"/></a>
			</div>
			<div class="top-nav">
				<ul class="tabs">
					<li><a href="addperson-1.php" id="marie-1">Le marié n&deg;1</a></li>
					<li><span class="bar"></span></li>
					<li><a href="addperson-2.php" id="marie-2">Le marié n&deg;2</a></li>
					<li><span class="bar"></span></li>
					<li><a href="addperson-3.php" id="marie-3_on"></a></li>
				</ul>
			</div>
			<div class="title">
				<h2>Les dates clé de votre histoire</h2>
				<p>Renseignez les informations suivantes :</p>
			</div>
			
			<form method="post" action="inc/addwedding.php" class="wedding_form relative" id="les-maries-3">
				<div class="showText"></div>
					<input type="hidden" name="addwedding-step" value="step-3">
					<div class="form_text">
						<label>Quelle est la date de votre rencontre?<span class="star">*</span></label>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="dd1" id="dd1" class="select_value" type="hidden" value="<?php echo $dd1; ?>"/>
								<p class="select_show">Jour</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_days(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="mm1" id="mm1" class="select_value" type="hidden" value="<?php echo $mm1; ?>"/>
								<p class="select_show">Mois</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_months(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="yyyy1" id="yyyy1" class="select_value" type="hidden" value="<?php echo $yyyy1; ?>"/>
								<p class="select_show">Année</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_years_birth(); ?>
								</div>
							</div>
						</div>
					</div>
					
					<div class="form_text">
						<label>Quand vous êtes-vous dit "oui"?<span class="star">*</span></label>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="dd2" id="dd2" class="select_value" type="hidden" value="<?php echo $dd2; ?>"/>
								<p class="select_show">Jour</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_days(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="mm2" id="mm2" class="select_value" type="hidden" value="<?php echo $mm2; ?>"/>
								<p class="select_show">Mois</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_months(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="yyyy2" id="yyyy2" class="select_value" type="hidden" value="<?php echo $yyyy2; ?>"/>
								<p class="select_show">Année</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_years_birth(); ?>
								</div>
							</div>
						</div>
					</div>
					
					<div class="form_text">
						<label>Quelle est la date de votre mariage?<span class="star">*</span></label>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="dd3" id="dd3" class="select_value" type="hidden" value="<?php echo $dd3; ?>"/>
								<p class="select_show">Jour</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_days(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="mm3" id="mm3" class="select_value" type="hidden" value="<?php echo $mm3; ?>"/>
								<p class="select_show">Mois</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_months(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="yyyy3" id="yyyy3" class="select_value" type="hidden" value="<?php echo $yyyy3; ?>"/>
								<p class="select_show">Année</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_years_wedding(); ?>
								</div>
							</div>
						</div>
					</div>
					
					
					
					<div class="upload_photo">
						<p>Photo de votre coupie</p>
						<input name="img_icon_data" id="img_icon_data" type="hidden" value="no" />
							
						<div class="upload_img">
							<?php if($img_url == ''){ ?><img src="images/photo-nofile.png"  /><?php }else{ ?>
							<div id="sliderload_img"><a href=""><img src="<?=  $app_media.$img_url; ?>" /></a></div>
							<?php } ?>
					    </div>
							
					    <div class="upload_image">
							<input name="img_url" id="img_url" type="file" onchange="ChangeMedia()"/>
							<a href="javascript:AnnulerUpload();"><img src="img/trash.gif" title="Annuler" width="16" height="16" class="trashIcon"/></a>
					    </div>	
					</div>
					<input type="submit" value="Enregister" name="submit" class="btn-save button" style=""/>
		    </form>
			
		
		</div>
	</div>
</body>